// Copyright (C) 2025, ZWSOFT Co., LTD.(Guangzhou)
// Licensed under the MIT License. See LICENSE in the project root for license information.

using CommunityToolkit.Mvvm.Input;
using TestClient.Domain;

namespace TestClient.ViewModel;

public partial class ConnectionTestViewModel : PageViewModelBase
{
    public IAsyncRelayCommand RunTestCommand { get; }

    public ConnectionTestViewModel(
        VFAdapterWrapper wrapper,
        ISnackNotifyService notifyService) : base(wrapper, notifyService)
    {
        RunTestCommand = CreateAsyncRpcCommand(RunTest);
    }

    private async Task RunTest()
    {
        await Task.Run(() => Wrapper.StartLinkWithCAD(3));
    }

    [RelayCommand]
    private void Reset()
    {
        TestResult = TestResult.Pending;
    }
}
